package jh.com.jhappbf.finance;

import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import jh.com.jhappbf.R;
import jh.com.jhappbf.weight.query.QueryWeight;

/**
 * @author Administrator
 */
public class FinanceMain extends Fragment implements OnClickListener {


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.finance_main, null);
        initView(v);
        return v;
    }

    private void initView(View v) {
        RelativeLayout mRLayoutDay = v.findViewById(R.id.finance_main_day_layout);
        RelativeLayout mRLayoutMonth = v.findViewById(R.id.finance_main_month_layout);
        RelativeLayout mRLayoutYear = v.findViewById(R.id.finance_main_year_layout);
        RelativeLayout mRLayoutSetting = v.findViewById(R.id.finance_main_setting_layout);
        TextView mTxtDay = v.findViewById(R.id.finance_main_day_txt);
        TextView mTxtMonth = v.findViewById(R.id.finance_main_month_txt);
        TextView mTxtYear = v.findViewById(R.id.finance_main_year_txt);
        TextView mTxtSetting = v.findViewById(R.id.finance_main_setting_txt);

        mRLayoutDay.setOnClickListener(this);
        mTxtDay.setOnClickListener(this);

        mRLayoutMonth.setOnClickListener(this);
        mTxtMonth.setOnClickListener(this);

        mRLayoutYear.setOnClickListener(this);
        mTxtYear.setOnClickListener(this);

        mRLayoutSetting.setOnClickListener(this);
        mTxtSetting.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
//		case R.id.finance_main_day_layout://添加结算
//		case R.id.finance_main_day_txt:
//			Intent i = new Intent(getActivity(), FinanceAdd.class);
//			i.putExtra("flag", "buy");
//			i.putExtra("data", mSettingModel);
//			startActivity(i);
//			break;
            case R.id.finance_main_month_layout://已结算查询
            case R.id.finance_main_month_txt:
                Intent i1 = new Intent(getActivity(), FinanceQuery.class);
                i1.putExtra("flag", "已结算");
//			i1.putExtra("data", mSettingModel);
                startActivity(i1);
                break;
            case R.id.finance_main_year_layout://综合查询
            case R.id.finance_main_year_txt:
                Intent i2 = new Intent(getActivity(), QueryWeight.class);
                i2.putExtra("flag", "all");
             //	i2.putExtra("data", mSettingModel);
                startActivity(i2);
                break;
            case R.id.finance_main_day_layout://未结算查询
            case R.id.finance_main_day_txt:
                Intent i3 = new Intent(getActivity(),FinanceQuery.class);
                i3.putExtra("flag", "未结算");
                startActivity(i3);
                break;
            default:
                break;
        }
    }

}